<?php 
/**
 * Default layout
 *
 * PHP versions 4 and 5
 *
 * TutoriumBase (http://tutoriumbase.my-reality.de)
 * Copyright 2012, Miguel Gonzalez (http://my-reality.de)
 *
 *
 * @copyright     Copyright 2012, Miguel Gonzalez (http://my-reality.de)
 * @link          http://tutoriumbase.my-reality.de TutoriumBase
 * @since         TutoriumBase v 0.1
 */

echo $html->docType('xhtml-trans'); 
header('Content-type: text/html; charset=UTF-8'); ?>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>    
<title><?php echo $title_for_layout;?></title>
<?php 
      echo $html->charset('utf-8');
      echo $this->Html->meta('icon');
      echo $html->script(array('images',
                               'jquery_1.6.4',
                               'dropdown',
                               'functions',
                               'input',  
                               'popup',
                               'checkbox'//,
                               //'prototype',
                               //'scriptaculous.js?load=effects'
                               ));
      echo $html->css(array('layout', 'popup'));
      
      // Für unregistrierte Benutzer
      echo $html->css(array('checkbox'));
?>
<link href="<?php echo $this->webroot . 'img/icon.png'; ?>" type="image/x-icon" rel="shortcut icon"/>
</head>
<body>
    <div id="wrapper">
    <!-- Top-Bar -->
    
    <div id="head"><div id="head_inner">
            <?php 
            
            if (!is_array($this->Session->read('Auth.User'))) 
            {
                $user = array();
            }
            echo $this->Layout->generateTopbar($categories, $user); ?>
        </div></div>
    
    <!-- Content -->
    
    <div id="content">
        <?php 
            // Checking for errors
            echo $this->Layout->checkCompatibility(); 
        ?>
        <div id="left">
        <?php 
        echo $session->flash();
        echo $content_for_layout; 
        ?>
        </div>
        <div id="right">
            
            <!-- Zusatzcontent -->
            <?php if (isset($rightbox) && !empty($rightbox)) { ?>
            
                <div id="rightbox" class="box">
                    <?php echo $rightbox; ?>
                </div>
            <?php } 
            
            if (!is_array($this->Session->read('Auth.User'))) 
            { ?>
                <!-- Registrier-Box -->
                <div class="box register-box">
                    <div class="text">Noch nicht dabei?</div>
                    <?php echo $this->Html->link(
                            '<div id="register" class="button_green">Registrieren</div>', 
                            array('controller' => 'Users', 'action' => 'register'), array('escape' => false, 'class' => 'buttonlink')); ?>
                </div>
            <?php }
            $count = 0;
            for ($i = 0; $i != count($categories); ++$i)
            {
                $count += count($categories[$i]['CategoryCount']);
            }
            
            if ($count) { ?>
            <div id="categories" class="box">
                <?php echo $this->Layout->showCategoryBox($categories); ?>
            </div> <?php } ?>
            
        </div>        
    </div>
    
    <!-- Footer -->
    
    <div id="footer">
        <?php echo $this->Layout->generateFooter($categories, $new_tutorials); ?>
    </div>
    <script type="text/javascript">
        javascript:init();
        </script>
    
    </div>
</body>
</html>
